<?php

use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Common Routes
|--------------------------------------------------------------------------
|
| Here is where you can register common routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "token" middleware group. Enjoy building your common!
|
*/
// 测试接口
Route::match(['GET', 'POST', 'DELETE'], 'test', 'Api\TestController@test');

// 附加身份信息
Route::middleware('authorization')->group(function (){
    // 用户登录
    Route::post('login', 'Common\UserController@login');
    // 短信验证码
    Route::post('sms/captcha', 'Common\SmsController@captcha');
    // 文件上传
    Route::post('file/upload', 'Common\FileController@upload');
    // 通知轮循
    Route::match(['get','post'], 'new/notice', 'Common\BaseController@newNotice');
    // 微信模块
    Route::prefix('wechat')->group(function (){
        // 微信登录
        // Route::post('login', 'Common\WechatController@login');
        // 绑定手机
        Route::post('bind/phone', 'Common\WechatController@bindPhone');
    });
});

Route::prefix('wechat')->group(function (){
    // 微信登录
    Route::post('login', 'Common\WechatController@login');
    // 微信登录
    Route::post('jsconfig', 'Common\WechatController@jsconfig');
});

// 权限控制
Route::middleware('authorization:common')->group(function (){
    // 退出登录
    Route::get('logout', 'Common\UserController@logout');
    // 辅助数据
    Route::match(['get','post'], 'assist', 'Api\BaseController@assist');
});
